package ICTCLAS.I3S.AC;

import ICTCLAS.I3S.AC.ICTCLAS50;
import java.util.*;
import java.io.*;


public class TestMain
{   
	public static void main(String[] args)
	{
		try
		{
			String sInput = "数据挖掘和机器学习领域有什么推荐的入门资料呢？";
			testICTCLAS_ParagraphProcess(sInput);
			testICTCLAS_FileProcess();
			

		}
		catch (Exception ex)
		{
		}
	}



	public static String testICTCLAS_ParagraphProcess(String sInput)
	{
		String nativeStr=null;
		try
		{
			ICTCLAS50 testICTCLAS50 = new ICTCLAS50();
			String argu = new File("").getAbsolutePath()+"\\bin";
			if (testICTCLAS50.ICTCLAS_Init(argu.getBytes("GB2312")) == false)
			{
				System.out.println("Init Fail!");
				return null;
			}


			testICTCLAS50.ICTCLAS_SetPOSmap(2);


			byte nativeBytes[] = testICTCLAS50.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 0, 0);
			nativeStr = new String(nativeBytes, 0, nativeBytes.length, "GB2312");
			System.out.println(nativeStr);


//			int nCount = 0;
//			String usrdir = "userdict.txt"; 
//			byte[] usrdirb = usrdir.getBytes();
//			nCount = testICTCLAS50.ICTCLAS_ImportUserDictFile(usrdirb, 0);
//			System.out.println(nCount);
//			nCount = 0;


//			byte nativeBytes1[] = testICTCLAS50.ICTCLAS_ParagraphProcess(sInput.getBytes("GB2312"), 2, 0);
//			System.out.println(nativeBytes1.length);
//			String nativeStr1 = new String(nativeBytes1, 0, nativeBytes1.length, "GB2312");
//			System.out.println(nativeStr1);
//			testICTCLAS50.ICTCLAS_SaveTheUsrDic();
//			testICTCLAS50.ICTCLAS_Exit();
		}
		catch (Exception ex)
		{
		}
return nativeStr;
	}



	public static void testICTCLAS_FileProcess()
	{
		try
		{
			ICTCLAS50 testICTCLAS50 = new ICTCLAS50();
			String argu = new File("").getAbsolutePath()+"\\bin";
			if (testICTCLAS50.ICTCLAS_Init(argu.getBytes("GB2312")) == false)
			{
				System.out.println("Init Fail!");
				return;
			}

			String Inputfilename = "D:\\test.txt";
//			byte[] Inputfilenameb = Inputfilename.getBytes();
			
			String Outputfilename = "D:\\test_result.txt";
//			byte[] Outputfilenameb = Outputfilename.getBytes();

			testICTCLAS50.ICTCLAS_FileProcess(Inputfilename.getBytes(), 0, 0, Outputfilename.getBytes());
//			int index = fileName.indexOf(".txt");
//			String out = fileName.substring(0, index) + "_pos.txt";
//			testICTCLAS50.ICTCLAS_FileProcess(fileName.getBytes(), 0, 1, out.getBytes());


//			String Outputfilename1 = "testing_result.txt";
//			byte[] Outputfilenameb1 = Outputfilename1.getBytes();
//
//			testICTCLAS50.ICTCLAS_FileProcess(Inputfilenameb, 0, 0, Outputfilenameb1);





		}
		catch (Exception ex)
		{
		}

	}

}


	
	

	